import graph

def read_graphs(filename):
    input_file = open(filename, 'r')
    curr_graph_db = graph.GraphDb()
    previous_graph = False
    for line in input_file:
        words = line.split()
        if len(words) > 0:
            if words[0] == "g":
                if previous_graph:
                    curr_graph_db.add_graph(curr_graph)
                curr_graph = graph.Graph(int(words[1]))
                previous_graph = True               
            elif words[0] == "v":
                curr_graph.add_vertex(int(words[1]), words[2])
            elif words[0] == "u":
                curr_graph.add_edge(int(words[1]), int(words[2]), int(words[3]), words[4])
    curr_graph_db.add_graph(curr_graph)
    input_file.close()
    return curr_graph_db

def read_attributes(filename):
    pass

